import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import DTO.LocaldataDTO;
import method.UserinfoCreate;
import javax.servlet.ServletException;
@WebServlet(urlPatterns = {"/dgrep"})
public class DgrepServlet extends HttpServlet{
    protected void doPost(HttpServletRequest req,
                          HttpServletResponse resp) throws IOException ,ServletException{
        String arr;
        LocaldataDTO localdataDTO=(LocaldataDTO)req.getSession().getAttribute("localdataDTO");
        arr=req.getParameter("new_password");
        UserinfoCreate userinfoCreate=new UserinfoCreate();
        userinfoCreate.setuser(localdataDTO.getUserid(),arr,localdataDTO.getLocalname(),localdataDTO.getPhone(),localdataDTO.getDgutid());
        localdataDTO=new LocaldataDTO(localdataDTO.getUserid(),arr,localdataDTO.getLocalname(),localdataDTO.getPhone(),localdataDTO.getDgutid());
        req.getSession().setAttribute("localdataDTO",localdataDTO);
        resp.sendRedirect("/HomePage.jsp");
    }
}